/*
//
//              INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license  agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in  accordance  with the terms of that agreement.
//    Copyright (c) 2007 Intel Corporation. All Rights Reserved.
//
//
*/

#ifndef __UMC_AVS_PICTURE_HEADER_H
#define __UMC_AVS_PICTURE_HEADER_H

#include "ippdefs.h"

namespace UMC
{

enum
{
    AVS_I_PICTURE               = 0,
    AVS_P_PICTURE               = 1,
    AVS_B_PICTURE               = 2
};

struct AVS_PICTURE_HEADER
{
    // picture start code
    Ipp32u picture_start_code;

    Ipp32u PictureType;

    // If bbv_delay is not equal to 0xFFFF, it specifies the waiting time
    // between the instance BBV received the last byte of picture start code
    // to the instance the decoding process is performed. It is in units
    // of a 90 kHz clock, which is derived from the 27 MHz system clock.
    // If bbv_delay is equal to 0xFFFF in one frame, the bbv_delay of all
    // the pictures in the whole video sequence shall be set to 0xFFFF.
    Ipp32u bbv_delay;

    // "1" indicates that time_code is present in bitstream. "0" indicates that
    // no time_code is present in bitstream.
    Ipp32u time_code_flag;

    // describes the time starting from the first frame with picture_distance 0
    // to the current frame.
    Ipp32u time_code;

    // is equal to the picture_distance of previous picture (display order)
    // plus 1, plus the number of skipped pictures between current picture
    // and previous picture (this number shall be less than 32),
    // in modulo 256 operation. picture_distance of the first picutre of
    // a sequence shall be 0.
    Ipp32u picture_distance;

    Ipp32u bbv_check_times;

    // '0' indicates that the two fields of the picture are interlaced fields
    // in which a time interval of the field period exists between the two
    // fields. In this case, repeat_first_field shall be '0'. '1' indicates
    // that both fields are from the same time instance. In this case,
    // PictureStructure shall be 1.
    Ipp32u progressive_frame;

    // '0' indicates that the coded data of the two fields of current picture
    // will appear in sequential order; '1' indicates that the coded data of
    // the two fields of current picture will appear in alternate order.
    // If progressive_sequence is '1', picture_structure shall also be '1'.
    // The value of PictureStructure is equal to picture_structure.
    Ipp32u picture_structure;

    Ipp32u top_field_first;

    Ipp32u repeat_first_field;

    // '1' indicates the quantization parameter does not change in the picutre.
    // '0' indicates the quantization parameter may change.
    Ipp32u fixed_picture_qp;

    // It specifies the quantization parameter of the picture, with a range
    // from 0 to 63 inclusive.
    Ipp32u picture_qp;

    // '1' indicates that the macroblock skip mode uses run-length coding. '0'
    // indicates the macroblock skip mode is derived from mb_type.
    Ipp32u skip_mode_flag;

    // '1' indicates that loop filter is disabled. '0' indicates that loop
    // filter is enabled.
    Ipp32u loop_filter_disable;

    // '1' means that picture header contains loop filter parameters
    // alpha_c_offset and beta_offset. Otherwise, alpha_c_offset and
    // beta_offset is not present in picture header.
    Ipp32u loop_filter_parameter_flag;

    // offset of loop filter A and C index of current picture. The range of
    // alpha_c_offset is [-8, 8]. AlphaCOffset is equal to alpha_c_offset. If
    // alpha_c_offset is not present in bitstream, AlphaCOffset is equal to 0.
    Ipp32s alpha_c_offset;

    // offset of loop filter B of current picture. The range of beta_offset
    // [-8, 8]. BetaOffset is equal to beta_offset. If beta_offset is not
    // present in the bitstream, BetaOffset is equal to 0.
    Ipp32s beta_offset;

    //
    // ADDITIONAL MEMBERS OF P,B HEADER
    //

    // coding type of an inter coded frame. '01' means that the frame uses
    // only forward prediction (P frame). '10' means that the frame uses
    // bi-directional prediction
    Ipp32u picture_coding_type;

    // It shall set to '1' to specify that the advanced prediction mode is
    // forbidden. '0' is reserved.
    Ipp32u advanced_pred_mode_disable;

    // '1' means that all macroblocks use default reference pictures.
    // '0' means that every macroblock specifies the reference pictures
    // to be used.
    Ipp32u picture_reference_flag;

    // not described in the standard flag. I don't know what it means.
    Ipp32u no_forward_reference_flag;

};

} // namespace UMC

#endif // __UMC_AVS_PICTURE_HEADER_H
